<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="../css/public.css">
<title>Insert title here</title>
</head>
<body>
<div id="maincontent">
<div id="headBlue">
<% 

	String stuId = (String) session.getAttribute("stuId");
 	if(stuId == null)
 		out.println("<script>alert('没有登录,请重新登录！');window.location='../stuLogin.html'</script>");
	int finalFee = 0;
	int i=1;
	String stuName=request.getParameter("stuName");
	Class.forName("com.mysql.jdbc.Driver").newInstance();
	Connection con = java.sql.DriverManager.getConnection("jdbc:mysql://localhost:3306/classfee", "root", "1234");
	Statement stmt = con.createStatement();
	ResultSet rst = stmt.executeQuery("SELECT stuName FROM  tb_student where (stuId='"+stuId+"')");
	while(rst.next())
		stuName=rst.getString("stuName");
%>
<ul class="nopoint"><li><img src="../image/head.png" style="width:30px;height:30px"/><a id="maname" href="studentupdate1.jsp" style="color:white;text-decoration: none;"><% out.println(stuName);rst.close();%></a><a href="../stulogout.jsp" style="margin-left:89%;color:white">退出登录</a></li></ul>
</div>
<div id="infotable" style="margin-left:35%">
<%
	ResultSet rs = stmt.executeQuery("SELECT className FROM  tb_class where classId=(select classId from tb_student where stuId='"+stuId+"')");
	if(rs.next()){
%>
	<p style="font-size:15px;font-family:'微软雅黑';font-weight:bold"><%out.println("所属班级："+rs.getString("className"));%></p>
	<p style="font-size:15px;font-family:'微软雅黑';margin-top:20px;">个人班费信息：</p>
<%} rs.close();%>
<table align="center" border="1" rules=rows rules=cols>
		<tr align="center">
			<td>序号</td>
		    <td style="width:120px">上缴班费金额</td>
		     <td style="width:120px">支出班费金额</td>
		    <td style="width:120px">日期</td>
		    <td>用途</td>
		</tr>
		<%ResultSet rst1 = stmt.executeQuery("SELECT * FROM  tb_classfee where stuId =('"+stuId+"')");
		 while(rst1.next()){
		%>
		<tr align="center">
		<td><%out.println(i++);%></td>
		<td><%out.println(rst1.getInt("inFee"));%></td>
		<td><%out.println(rst1.getInt("outFee"));%></td>
		<td><%out.println(rst1.getString("date"));%></td>
		<td><%out.println(rst1.getString("useWay"));%></td>
		</tr>
		<%
			}
		 rst1.close();
		 stmt.close();
		 con.close();
		%>
	</table>
</div>
</div>
</body>
</html>